<%@page import="com.sjyy.hospital.model.*" %>

<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib tagdir="/WEB-INF/tags/simpletable" prefix="simpletable"%>
<%@ include file="/commons/taglibs.jsp" %>

<rapid:override name="head">
	<title>Hospital维护</title>
	
	<script src="${ctx}/scripts/rest.js" ></script>
	<link href="<c:url value="/widgets/simpletable/simpletable.css"/>" type="text/css" rel="stylesheet">
	<script type="text/javascript" src="<c:url value="/widgets/simpletable/simpletable.js"/>"></script>
	<script src="<c:url value="/scripts/jquery.js"/>" type="text/javascript"></script>
	<script src="<c:url value="/scripts/application.js"/>" type="text/javascript"></script>
	
	<script type="text/javascript" >
		$(document).ready(function() {
			window.simpleTable = new SimpleTable('queryForm',${page.thisPageNumber},${page.pageSize},'${pageRequest.sortColumns}');
		});
	</script>
</rapid:override>

<rapid:override name="content">
	<form id="queryForm" name="queryForm" method="get" style="display: inline;">
	<div class="queryPanel">
		<fieldset>
			<table>
				
				<div class="form-group inline icon">
				<!--	<input placeholder="城市" value="${query.areaId}" id="areaId" name="areaId" maxlength="32"  class="form-field"/>  -->
					<label>城市:</label>
					<select class="form-field col-2" value="${query.areaId}" name="areaId" id="areaId">
					<option value="">全部</option>
					<c:forEach items="${areaIdList}" var="item">								
						<option value="${item.key }" 
						<c:if test="${item.key eq query.areaId}">
							selected="selected"
						</c:if>
						>${item.value }</option>
					</c:forEach>						
				</select>
					
					
					<br/>
				</div>
				
				<div class="form-group inline icon">
				<i class="icon-align-justify"></i>	
					<input placeholder="名称" value="${query.name}" id="name" name="name" maxlength="32"  class="form-field"/>
					<br/>
				</div>
				
				<div class="form-group inline icon">
				<!--  
					<input placeholder="等级" value="${query.level}" id="level" name="level" maxlength="32"  class="form-field"/>
					<br/>
					-->
				 <label>级别:</label>
				<select class="form-field col-2" value="${query.level}" name="level" id="level">
				
					<option value="" <c:if test="${query.level == 0}"> selected </c:if>>全部</option>
					<option value="1" <c:if test="${query.level == 1}"> selected </c:if>>一级</option>
					<option value="2" <c:if test="${query.level == 2}"> selected </c:if>>二级</option>
					<option value="3" <c:if test="${query.level == 3}"> selected </c:if>>三级</option>
					<option value="4" <c:if test="${query.level == 4}"> selected </c:if>>社区</option>	
					<option value="5" <c:if test="${query.level == 5}"> selected </c:if>>诊所</option>					
				</select>	
				<br/>
				</div>
				
				<div class="form-group inline icon">
				 <label>类型:</label>
					<select class="form-field col-2" value="${query.type}" name="type" id="type">
					<option value="">全部</option>
					<option value="1">国营</option>
					<option value="2">私营</option>
				</select>
					<br/>
				</div>
				
				<div class="form-group inline icon">
				<select class="form-field col-2" value="${query.status}" name="status" id="status">
					<option value="">全部</option>
					<option value="1">运营中</option>
					<option value="2">停止运营</option>
				</select>	
					<br/>
				</div>
				
				<button type="submit" class="btn btn-default" onclick="getReferenceForm(this).action='${ctx}/hospital'">查询</button>
			</table>
			
		</fieldset>
		<div class="handleControl">
			<button type="button" class="btn btn-default" onclick="window.location = '${ctx}/hospital/new'">新增</button>
			<button type="button" class="btn btn-default" onclick="doRestBatchDelete('${ctx}/hospital','items',document.forms.queryForm)">删除</button>
		</div>
	
	</div>
	
	<div class="gridTable">	
		<table width="100%"  border="0" cellspacing="0" class="table text-center">
		  <thead>			  
			  <tr>
				<th style="width:1px;"><input type="checkbox" onclick="setAllCheckboxState('items',this.checked)"></th>
				<th sortColumn="area_id" >城市</th>
				<th sortColumn="level" >级别</th>
				<th sortColumn="name" >名称</th>
				<th sortColumn="type" >类型</th>
				<th sortColumn="status" >状态</th>
				<th sortColumn="summary" >概述</th>
				<th style="white-space:nowrap;">操作</th>
			  </tr>			  
		  </thead>
		  <tbody>
		  	  <c:forEach items="${page.result}" var="item" varStatus="status">
			  <tr class="${status.count % 2 == 0 ? 'odd' : 'even'}">
				<td><input type="checkbox" name="items" value="${item.hospitalId}"></td>
				<!-- 	<td><c:out value='${item.areaId}'/>  -->
				
				<td>
				<c:forEach items="${areaIdList}" var="areaIdListItem">								
						<c:if test="${areaIdListItem.key eq item.areaId}">
						<label> ${areaIdListItem.value }</label>
						</c:if>
				</c:forEach>
				&nbsp;
				</td>
				<td>
					<c:if test="${item.level == 1}"> 一级 </c:if>
					<c:if test="${item.level == 2}"> 二级 </c:if>
					<c:if test="${item.level == 3}"> 三级 </c:if>
					<c:if test="${item.level == 4}"> 社区 </c:if>
					<c:if test="${item.level == 5}"> 诊所 </c:if>&nbsp;
					</td>
				<td><c:out value='${item.name}'/>&nbsp;</td>
				<td>
					<c:if test="${item.type == 1}"> 国营 </c:if>
					<c:if test="${item.type == 2}"> 私营 </c:if>&nbsp;
				</td>
				<td>
					<c:if test="${item.status == 1}"> 运营中 </c:if>
					<c:if test="${item.status == 2}"> 停止运营 </c:if>&nbsp;
				</td>
				<td><c:out value='${item.summary}'/>&nbsp;</td>
				<td>
					<a href="${ctx}/hospital/${item.hospitalId}">查看</a>&nbsp;&nbsp;
					<a href="${ctx}/hospital/${item.hospitalId}/edit">修改</a>&nbsp;&nbsp;
					<a href="${ctx}/hospital/${item.hospitalId}" onclick="doRestDelete(this,'你确认删除?');return false;">删除</a>
				</td>
			  </tr>
			  
		  	  </c:forEach>
		  </tbody>
		</table>
	
		<simpletable:pageToolbar page="${page}">
		</simpletable:pageToolbar>
		
	</div>
	</form>
</rapid:override>
<rapid:override name="script"><script></script></rapid:override>
<%@ include file="base.jsp" %>
